//
//  APIAccountManager.m
//  cocoapodText
//
//  Created by apple on 16/10/18.
//  Copyright © 2016年 apple. All rights reserved.
//


#import "NetTool.h"
#import "AFNetworking.h"
#import "APIAccountManager.h"

@interface APIAccountManager()

@end
@implementation APIAccountManager

-(void)fsgy_api_info_account_pass_change_withName:(NSString *)userName UserOldPassword:(NSString *)userOldPassword UserPassword:(NSString *)userPassword{
    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    //申明返回的结果是json类型
    session.responseSerializer = [AFJSONResponseSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    session.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
    NSString *neturl=[NetTool fsgy_info_account_pass];
    NSDictionary *params=@{@"action":@"saveUserPwd",@"oldPassword":userOldPassword,@"password":userPassword};
    [session GET:neturl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        if([_delegate respondsToSelector:@selector(onAccountManager:result:)]){
            [_delegate onAccountManager:self result:responseObject];
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        //[CommonTool isSessionExpired:task];
        NSLog(@"error=%@",error);
    }];
}



@end
